'use strict';
/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller } = app;
  /**
   * 后台管理
   */
  router.post('/lingxi/upload/file', controller.uploadcos.file);

  /**
   * 用户权限相关
   */
  router.post('/lingxi/user/login', controller.user.login);
  router.post('/lingxi/user/register', controller.user.register);
  router.put('/lingxi/user/updatePassword', controller.user.updatePassword);
  router.get('/lingxi/user/getUserInfo', controller.user.getUserInfo);
  router.resources('user', '/lingxi/user', controller.user);

  router.get('/lingxi/model/list', controller.model.allList);
  router.get('/lingxi/model/userList', controller.model.userList);
  router.resources('model', '/lingxi/model', controller.model);

  /**
   * AI 会话管理
   */
  router.get('/lingxi/conversation/list', controller.conversation.allList);
  router.resources('conversation', '/lingxi/conversation', controller.conversation);
  router.resources('message', '/lingxi/message', controller.message);

  /**
   * 业务代码
   */
  router.post('/lingxi/gpt/chat', controller.gpt.chat);
  router.post('/lingxi/deepseek/chat', controller.deepseek.chat);
  router.post('/lingxi/wanxiang/generate', controller.wanxiang.generate);
  /**
   *
        create: (params) => request.post('/mj'),
        fetch: (params) => request.get('/mj/fetch', params),
        action: (params) => request.post('/mj/action', params),
        model: (params) => request.post('/mj/model', params),
   */
  router.post('/lingxi/mj/create', controller.mj.create);
  router.get('/lingxi/mj/fetch', controller.mj.fetch);
  router.post('/lingxi/mj/action', controller.mj.action);
  router.post('/lingxi/mj/model', controller.mj.model);
};
